<?php
include dirname(__FILE__)."/../database/database.class.php";

$db->doSQL("SELECT ID, name FROM Card WHERE expansion=5");

$temp_array = array();
while($row = $db->getrecord())
{
  array_push($temp_array, $row);
}

foreach($temp_array as $card)
{
  $ending = "*";
  $files = glob("../images/cards/AvacynRestored/".str_replace('&ouml;','ö',str_replace('&#198;','Æ',str_replace(' ', '_', $card->name))).$ending);
  echo "$card->ID ".substr($files[0],-10, 6)."<br>";
  $db->doSQL("INSERT INTO card_externalid (card_ID, multiverse_ID) VALUES($card->ID,".substr($files[0],-10, 6).");");
}

?>
